package com.xy.framework.mreturn;

import java.io.Serializable;

@SuppressWarnings("serial")
public class MReturnObject implements Serializable {

	public static final int SUCCESS = 20000;
	public static final int ERROR = 20001;
	public static final int TIMEOUT = 20002;// session超时
	public static final int FATAL_ERROR = 20003;
	public static final int WARNING = 20004;
	public static final int LOGIN_ERROR = 20005;

	private int code;// 返回该次请求状态code
	private String message;// 消息内容
	private Object data;// 封装好的返回对象数据模型（可能是json对象或者json数组，亦或者是一个value）
	private String sessionId;// 加入sessionid参数，保存会话
	private int total;// 总页数

	public MReturnObject() {
		// TODO Auto-generated constructor stub
	}

	public MReturnObject(int code) {
		this.code = code;
	}

	public MReturnObject(int code, Object data) {
		this.code = code;
		this.data = data;
	}

	/**
	 * 分页
	 * 
	 * @param code
	 * @param data
	 */
	public MReturnObject(int code, Object data, int total) {
		this.code = code;
		this.data = data;
		this.total = total;
	}

	public MReturnObject PageMReturnObject() {
		return this;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

}
